import hashlib

from Crypto.Cipher import DES3
import base64


def create_key(sk):
    print(sk)
    r = hashlib.md5(sk).digest()
    print(r)
    return r


def init_str(s):
    l = len(s) % 16
    if l != 0:
        c = 16 - l
        s += chr(c) * c
    return s


key = 'dcd1090ea04320969ed01c93b723f714'  # 秘钥

b2bpwd = "oohbv"
keys = create_key(key.encode())

ss = init_str(b2bpwd)
des3 = DES3.new(keys, DES3.MODE_ECB)
res2 = des3.encrypt(ss.encode())
b2bencryptkey = base64.standard_b64encode(res2)
print(b2bencryptkey)
